package com.wlz.principle.openclose.impl;

public class OffNovelBook extends NovelBook {
    public OffNovelBook(String name, int price) {
        super(name, price);
    }

    @Override
    public int getPrice() {
        //原价
        int selfPrice = super.getPrice();
        int offPrice = 0;
        if (selfPrice > 4000) { //原价大于40元,则打9折
            offPrice = selfPrice * 90 / 100;
        } else {
            offPrice = selfPrice * 80 / 100;
        }
        return offPrice;
    }
}
